<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style>
        * {
            box-sizing: border-box;
        }
        :root {
            --font-size: 14px;
            --auto-width: 10px;
            --auto-height: 10px;
            --modal-border-color: rgba(102, 255, 255, 0.9);
            --card-bg: linear-gradient(180deg, #64AFA8 0%, #486F6F 6%, #486F6F 52%, #4a7d7d 92%, #6ab0a9 100%);
            --modal-header-bg: #09413D;
            --modal-header-img: url(http://192.168.1.194:9090/theme/theme_20241209_BLA_6641/1d54126c4e3f4a7b8165c786a2cca931.png);
            --btn-bg-img: url(http://192.168.1.194:9090/theme/theme_20241209_BLA_6641/f4ea035604c04c7f8d108d14e8fde04b.png);
        }
        .root-confirm {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, calc(-50% - 100px));
            // width: 20vw;
            // height: 10vh;
            font-size: calc(var(--font-size, 14px)* 1.14);
            z-index: 29892014;
            border: 1px solid var(--modal-border-color);
            background: var(--card-bg);
        }
        .root-confirm-header {
            width: 100%;
            height: 26px;
            line-height: calc(var(--auto-height, 10px)* 3);
            background-image: var(--modal-header-img);
            background-color: var(--modal-header-bg);
            padding-left: calc(var(--auto-width, 10px)* 2.8);
            background-repeat: no-repeat;
            background-size: calc(var(--auto-height, 10px)* 20) calc(var(--auto-width, 10px)* 2.8);
        }
        .root-confirm-title {
            font-size: 16px;
            font-weight: bolder;
            color: rgb(255, 255, 255);
            text-align: left;
        }
        .root-confirm-body {
            padding: 10px 20px;
            background: var(--card-bg);
        }
        .root-confirm-body-context {
            padding: 10px 20px;
            color: rgb(255, 255, 255);
            text-align: center;
        }
        .root-confirm-footer {
            padding-top: 10px;
            display: flex;
            justify-content: flex-end;
        }
        .root-confirm-footer-btn {
            border: none;
            color: rgb(220, 220, 220);
            text-align: center;
            background-image: var(--btn-bg-img);
            background-color: transparent;
            background-repeat: no-repeat;
            background-size: 100% 100%;
            padding: 0 10px;
            background-position: center;
            line-height: calc(var(--auto-height, 10px)* 2.8);
            font-size: var(--font-size, 14px);
            cursor: pointer;
            transition: color .3s ease-out;
        }
        .root-confirm-footer-btn:hover {
            color: rgb(255, 255, 255);
            transition: color .2s ease-in;
        }
        .root-confirm-footer-btn + .root-confirm-footer-btn {
            margin-left: 10px;
        }
    </style>
    <script src="./jquery.js"></script>
</head>
<body>


<script>
    function confirm (content = '实例内容', { title, cancelText = '取消', okText = '确定', cancel, ok } = {}) {
        const $template = $(`
            <div class="layui-layer-shade" style="z-index: 19891014; background-color: rgb(0, 0, 0); opacity: 0.3;"></div>
            <div class="root-confirm">

                <div class="root-confirm-body">
                    <div class="root-confirm-body-context">${ content }</div>
                    <div class="root-confirm-footer">
                        <button class="root-confirm-footer-btn root-confirm-footer-btn-cancel" style="">${ cancelText }</button>
                        <button class="root-confirm-footer-btn root-confirm-footer-btn-ok">${ okText }</button>
                    </div>
                </div>
            </div>
        `);
        if (title) {
            $template.find('.root-confirm-body').before(`
                <div class="root-confirm-header">
                    <span class="root-confirm-title" style="">${ title }</span>
                </div>
            `)
        }

        $('body').append($template);

        function onConfirmCancel () {
            $template.remove();
            cancel?.()
        }

        function onConfirmOk () {
            ok?.($template)
        }

        $template.on('click', '.root-confirm-footer-btn-cancel', onConfirmCancel)
        $template.on('click', '.root-confirm-footer-btn-ok', onConfirmOk)
    }

    confirm(`<div style="padding: 20px;">随便提十点啥</div>`, {
        title: 'xxxxx',
        ok($template) {
            console.log($template.remove())
        }
    })
</script>
</body>
</html>